package model.roomManagement.Implementation;

import java.io.Serializable;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;

import model.roomManagement.Interface.IUser;



public class User implements IUser,Serializable{
	
	private String name;
	private String password;
	private int id;
	private String ip;
	private int port;
	  InetSocketAddress audioInetSocketAddress;//语音地址
	
	
	public InetSocketAddress getAudioInetSocketAddress() {
		return audioInetSocketAddress;
	}

	public void setAudioInetSocketAddress(InetSocketAddress audioInetSocketAddress) {
		this.audioInetSocketAddress = audioInetSocketAddress;
	}

	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
		try {
			this.setAudioInetSocketAddress(new InetSocketAddress(InetAddress.getByName(ip),port));
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	private ArrayList roomList;
	
	
	public User(String name,String password,int id,ArrayList roomList){
		this.name=name;
		this.password=password;
		this.id=id;
		this.roomList=roomList;
	}
	
	public User() {
		// TODO Auto-generated constructor stub
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}


	public ArrayList getRoomList() {
		return roomList;
	}

	public void setRoomList(ArrayList roomList) {
		this.roomList = roomList;
	}



	@Override
	public void addRoomId(int id) {
		roomList.add(id);
		
	}

	@Override
	public void deleteRoomId(int id) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public String getIp() {
		// TODO Auto-generated method stub
		return ip;
	}

}
